package com.ygq.ex;

import Exceptions.*;
import constant.CodeConstant;
import constant.MessageConstant;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import result.Result;


/**
 * 全局异常处理器
 */
@RestControllerAdvice
public class GlobalExceptionHandler {

    /**
     * 捕获所有异常
     */
    @ExceptionHandler(Exception.class)
    public Result ex(Exception exception){
        return Result.error(MessageConstant.SYSTEM_FAILURE, CodeConstant.SYSTEM_FAILURE);
    }
}
